Properties & Methods

Following is a list of properties and methods that you can use with VSFlexData:

AddFirst
Applies To
Array, Map
See Also
AddLast, Insert, Remove, RemoveAll
Description
This method adds an element to the first position of an existing array or a map.
Example
  • vsfX.AddFirst "Visual Basic"
  • vsfX.AddFirst 5.83

 

AddLast
Applies To
Array, Map
See Also
AddFirst, Insert, Remove, RemoveAll
Description
This method adds an element to the last position of an existing array or a map.
Example
  • vsfX.AddLast "Visual Basic"
  • vsfX.AddLast 5.83

 

Become
Applies To
All Types
See Also
Clone, Export, Import, GetObjectString, SetObjectString
Description
This method is used to copy the data from another VSFlexData object to itself.
Example
  • vsfX.Become vsfY

 

Clone
Applies To
All Types
See Also
Become, Export, Import, GetObjectString, SetObjectString
Description
This method is used to copy data from a given VSFlexData object to another.
Example
  • Set vsfX = vsfY.Clone

 

DebugPrint
Applies To
All Types
See Also
GetObjectString, SetObjectString, Version, Tag
Description
This method is mainly used for debugging. It displays the current data stored in the object.
Example
  • Debug.Print vsfX.DebugPrint

 

Exists
Applies To
All except Variant
See Also
Find
Description
Exists looks for a specified datum in the object and returns True or False depending on whether that datum currently exists in the object.

NOTE
In case of a Map, Exists method searches for a key.

Example
  • If vsfX.Exists("Visual Basic") Then
    ...
    Endif

 

Export
Applies To
All Types
See Also
Become, Clone, Import, GetObjectString, SetObjectString
Description
Export is used to Export a VSFlexData object to a disk file. You can later load the object from a disk file using the Import method.
Example
  • vsfX.Export "C:\Temp\MyObject.VSF"

 

Find
Applies To
All Types
See Also
Exists
Description
Find looks for a specified datum in the object. If found, returns the position, otherwise returns -1.

NOTE
In case of a Map, Find method searches for a key.

Example
  • lngPosition = vsfX.Find("Visual Basic")

 

GetKeys
Applies To
All Types
See Also
Map
Description
GetKeys method enumerates the keys of a Map and returns a VSFlexData of Array type.
Example
  • Set vsfY = vsfX.GetKeys

 

GetObjectString
Applies To
All Types
See Also
Become, Clone, Export, Import, SetObjectString
Description
GetObjectString returns a string that contains the object data with type information. Later you can use SetObjectString to restore the object. The Import and Export methods use GetObjectString and SetObjectString to import/export data to and from a disk file. This method is provided in case you might want to export the object data to a binary file or a database.

NOTE:
If all you want to accomplish is create an in-memory copy of an object, it's much faster to use the Become and Clone methods as compared to using the GetObjectString of one object as a parameter to SetObjectString of another object.

Example
  • strObjectString = vsfX.GetObjectString

 

Import
Applies To
All Types
See Also
Become, Clone, Export, GetObjectString, SetObjectString
Description
Import is used to import a text file previously written by the Export method.
Example
  • vsfX.Import "C:\Temp\MyObject.VSF"

 

Insert
Applies To
Array
See Also
AddFirst, AddLast, Remove, RemoveAll
Description
This method is used to insert an element into an array type VSFlexData at a given position.
Example
  • vsfX.Insert 5, "Visual Basic"

 

IsArray, IsBoolean, IsCurrency, IsDate,
IsDouble, IsEmpty, IsInteger, IsLong,
IsNull, IsNumeric, IsObject, IsSingle,
IsString
Applies To
All Types
See Also
Description
These methods are used to determine the type of a given datum stored in the object.
Example
  • vsfX.IsNumeric("SomeKey")
    ' vsfX is of type Map and "SomeKey" is a valid key.
  • vsfX.IsBoolean(1)
    ' vsfX is either a map or an array, and an element exists at position 1.

 

Length
Applies To
All Types
See Also
Description
Returns the number of elements in the object.
Example
  • lngNumElements = vsfX.Length

 

Pop
Applies To
Stack, Queue
See Also
Push
Description
This method is used to pop an element from a Stack or a Queue. In case of a stack, it returns the last element added by the Push method -- where as in case of a Queue, it returns the first element added by the Push method.
Example
  • x = vsfX.Pop

 

Push
Applies To
Stack, Queue
See Also
Pop
Description
Adds an element to a stack or a queue.
Example
  • vsfX.Push "Visual Basic"
  • vsfX.Push 5.83

 

Remove
Applies To
Array, Map
See Also
AddFirst, AddLast, Insert, RemoveAll
Description
Removes a given element from an array or a map.
Example
  • vsfX.Remove 3
    ' Removes element at position 3 from an array or a map.
  • vsfX.Remove("SomeKey")
    ' Removes element referenced by key "SomeKey" in a map.

 

RemoveAll
Applies To
Array, Map
See Also
AddFirst, AddLast, Remove, RemoveAll
Description
This method is used to remove all the elements from an array or a map.
Example
  • vsfX.RemoveAll

 

SetArray
Applies To
See Also
Data Types
Description
This method is used to initialize the object as an array.
Example
  • vsfX.SetArray
    ' Dynamic array - no limit on the number of elements.
  • vsfX.SetArray 5
    ' Static array - a maximum of 5 elements can be added.

 

SetMap
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a map.
Example
  • vsfX.SetMap

 

SetNil
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a nil.
Example
  • vsfX.SetNil

 

SetObjectString
Applies To
All Types
See Also
Become, Clone, Export, Import, GetObjectString
Description
See GetObjectString
Example
  • vsfX.SetObjectString strObjectString

 

SetQueue
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a queue.
Example
  • vsfX.SetQueue

 

SetSet
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a set.
Example
  • vsfX.SetSet ("Jan", "Feb", "Mar")
  • vsfX.SetSet (2,4,6,8,10)

 

SetStack
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a stack.
Example
  • vsfX.SetStack

 

SetVariant
Applies To
See Also
Data Types
Description
This method is used to initialize the object as a variant, so that any of the Visual Basic intrinsic data types can be stored. By default, when you instantiate an object of VSFlexData, it is set as a variant.
Example
  • vsfX.SetVariant

 

Tag
Applies To
All Types
See Also
DebugPrint, Version
Description
Tag is a property that you can use to identify the object. This property can be freely set to any string by the programmer and has no effect on the object whatsoever. It can be a great help in debugging especially if you are dealing with complex data structures.
Example
  • vsfX.Tag = "My first object"

 

Version
Applies To
All Types
See Also
DebugPrint, Tag
Description
Returns the version of the VSFlexData DLL being used.
Example
  • strVersion = vsfX.Version